package com.hoshiicloud.saleorder.feign;

import com.hoshiicloud.common.rpc.Response;
import com.hoshiicloud.saleorder.dto.PlatStoreDTO;
import com.hoshiicloud.saleorder.feign.hystrix.HystrixPlatStoreFeignFallback;
import com.hoshiicloud.user.dto.platform.PlatDTO;
import com.hoshiicloud.user.entity.store.PlatStore;
import java.util.List;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author Markerccc
 * @date 2019/8/26 - 14:37
 */
@FeignClient(name = "hoshiicloud-user", fallback = HystrixPlatStoreFeignFallback.class)
public interface PlatStoreService {

    /**
     * 获取门店
     *
     * @param id 店铺ID
     * @return PlatStoreDTO
     */
    @GetMapping("/store/plat-store/{id}")
    Response<PlatStoreDTO> getStore(@PathVariable("id") Long id);

    /**
     * 判断是否为总店
     *
     * @param storeId storeId
     * @return Boolean
     */
    @GetMapping("/store/plat-store/identifyMainStoreById")
    Response<Boolean> identifyMainStoreById(@RequestParam("storeId") Long storeId);

    /**
     * 得到这个店铺总店下面的所有分店
     *
     * @param storeId storeId
     * @return List
     */
    @GetMapping("/store/plat-store/getAllBranchStore")
    Response<List<PlatStore>> getAllBranchStore(@RequestParam("storeId") Long storeId);

    /**
     * 根据店铺ID拿到平台信息, 以及
     *
     * @param storeId storeId
     * @return PlatDTO
     */
    @GetMapping("/store/plat-store/getStoreAndFormByStoreId")
    Response<PlatDTO> getStoreAndFormByStoreId(@RequestParam("storeId") Long storeId);
}
